"""
sum(1 + 2 + 4 + 8 + ... + 100)
"""

import math


def f4(m, showList=False):
    intmultiple = int(math.log2(m))
    res = [2 ** i for i in range(intmultiple + 1)]
    res += [m] if m > 2 ** intmultiple else []
    if showList:
        print(res)
    return sum(res)


if __name__ == '__main__':
    print(f4(100))
